clear all
import excel "raw.xlsx", sheet("Sheet1") firstrow
**convert return factors to prices
gen q1=1/p1
gen q2=1/p2
gen q3=1/p3
gen q4=1/p4


**Table 13. Regression Analysis on Price Effect
xi: tobit x1 q1 q2 q3 q4, ll(0) ul(100) vce(cluster subjectid)
outreg2 using Tab13,  bdec(3) sdec(3) bracket excel drop(_I*)  addstat(Pseudo R-squared, `e(r2_p)')
xi: tobit x2 q1 q2 q3 q4, ll(0) ul(100) vce(cluster subjectid)
outreg2 using Tab13,  bdec(3) sdec(3) bracket excel drop(_I*)  addstat(Pseudo R-squared, `e(r2_p)')
xi: tobit x3 q1 q2 q3 q4, ll(0) ul(100) vce(cluster subjectid)
outreg2 using Tab13,  bdec(3) sdec(3) bracket excel drop(_I*)  addstat(Pseudo R-squared, `e(r2_p)')
xi: tobit x4 q1 q2 q3 q4, ll(0) ul(100) vce(cluster subjectid)
outreg2 using Tab13,  bdec(3) sdec(3) bracket excel drop(_I*)  addstat(Pseudo R-squared, `e(r2_p)')


*Figure 1: Average tokens allocated to each asset
ssc install cibar
expand 2
expand 2
gen n=_n
gen copy=1 if n<=4223
replace copy=2 if n>4223 & n<=8446
replace copy=3 if n>8446 & n<=12669
replace copy=4 if n>12669
gen p=q1 if copy==1
replace p=q2 if copy==2
replace p=q3 if copy==3
replace p=q4 if copy==4
gen tokenx=x1 if copy==1
replace tokenx=x2 if copy==2
replace tokenx=x3 if copy==3
replace tokenx=x4 if copy==4

gen statetime="Head/Early" if copy==1
replace statetime="Tail/Early" if copy==2
replace statetime="Head/Late" if copy==3
replace statetime="Tail/Late" if copy==4
label define mylabel 1 "Head/Early" 2 "Tail/Early" 3 "Head/Late" 4 "Tail/Late"
encode (statetime), gen(state_time) label(mylabel)
gen price="2"
replace price="1.25" if p<1.3
replace price="1" if p<1.1
replace price="0.8" if p<0.9
replace price="0.5" if p<0.6
encode (price), gen(prices)

cibar tokenx, over1(state_time) over2(prices) barcolor(gs2 gs4 gs6 gs8) graphopts(xtitle("Price") ytitle("Average tokens allocated") legend(rows(1)  symxsize(3) lab(1 "Head/Early") lab(2 "Tail/Early") lab(3 "Head/Late") lab(4 "Tail/Late")) graphregion(color(white)))
graph save Figure1.gph
